# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         demo02
# Description:   自定义异常类
# Author:       ASUS
# Date:         2019/3/20
#-------------------------------------------------------------------------------


class Myexception(Exception):
    def __init__(self, *args, **kwargs):
        self.msg = args[2]
    def __str__(self):
        return self.msg

a = 10
b = 0
if b == 0:
    raise Myexception("系统提示",'除数不能为零',"下次不要再这样了")
else:
    print(a/b)

print("-------------------")

#主动抛出异常常见的替代方法
def ab_div(a,b):
    if b == 0:
        return "除数不能为0"
    else:
        return a/b

c = ab_div(a,b)
print(c)

